home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / PASCAL / BIGLDSW.ZIP / TUTOR1.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-07-28  |  1.8 KB  |  68 lines

  1. {
  2.   TUTOR1.PAS
  3.  
  4.   Example file to show how to use the _BigLoad - Toolkit.
  5.  
  6. }
  7.  
  8. uses crt, _BigLoad;
  9.  
  10. const
  11.   Stream1 : byte = 1;
  12.  
  13. var
  14.   HelpByte   : Byte;
  15.   HelpString : String;
  16.  
  17. begin
  18.   ClrScr;
  19.  
  20.   { open the BigFile "TESTBIG" and handle the index from disk. You may also
  21.     try to hanlde the index from memory with IndexFromMemory }
  22.   BigFileInit( 'TESTBIG', IndexFromDisk );
  23.  
  24.   { checks if a file with the specified name exists in the opened BigFile }
  25.   Write( 'The File TESTFILE.TXT does ' );
  26.   if BigFileExists( 'TESTFILE.TXT' ) then
  27.       WriteLn( 'exist.' )
  28.     else
  29.       WriteLn( 'not exist.' );
  30.  
  31.   { open a file for reading from the BigFile by the stream Stream1 and
  32.     reset it. The second parameter of BigReset has NO effect on any
  33.     procedures or functions of BigLoad. It exists just to make it easier
  34.     to convert your routines to BigFile-compatible ones. }
  35.   BigAssign( Stream1, 'TESTFILE.TXT' );
  36.   BigReset( Stream1, 1 );
  37.  
  38.   { get the size of a file }
  39.   Write( 'The FileSize of TESTFILE.TXT is ' );
  40.   Writeln( BigFileSize( Stream1 ), ' bytes ' );
  41.  
  42.   { read the file and display it on the screen as long as you don't have
  43.     reached the End Of File (EOF). }
  44.   WriteLn( 'File contains : ' );
  45.   while not BigEOF( Stream1 ) do
  46.     begin
  47.       BigReadS( Stream1, HelpString );
  48.       WriteLn( HelpString );
  49.       { You may also try the folling code: }
  50.       {BigReadB( Stream1, HelpByte );
  51.       Write( Chr( HelpByte ) );}
  52.     end;
  53.  
  54.   { seek to file position 20 }
  55.   BigSeek( Stream1, 20 );
  56.  
  57.   { read the 20th character }
  58.   Write( 'The 20th character is : ' );
  59.   BigReadB( Stream1, HelpByte );
  60.   WriteLn( Chr( HelpByte ) );
  61.  
  62.   { close stream Stream1 of the BigFile }
  63.   BigClose( Stream1 );
  64.  
  65.   { close reading from the BigFile }
  66.   BigFileClose;
  67. end.
  68.